<template>
	<view class="floor-card">
		<image class="image" :src="serverUrl+imgUrl" alt="" mode="widthFix">
			<view>
				<slot>
					<view class="color-red" style="padding: 8rpx 0;" v-if="!goodsName">
						￥{{price}}
					</view>
					<view v-else style="padding-left: 10rpx">
						<view class="card-title">{{goodsName}}</view>
						<view>
							<text class="color-red">￥{{price}}</text>
							<text class="del-line">￥{{prePrice}}</text>
						</view>
					</view>
				</slot>
			</view>
	</view>
</template>

<script>
	export default {
		name: "floor-card",
		props: {
			imgUrl: {
				type: String
			},
			price: {
				type: Number,
				default: 128
			},
			prePrice: {
				type: Number,
			},
			goodsName: {
				type: String
			}
		}
	}
</script>

<style lang="scss">
	.del-line {
		padding-left: 8rpx;
		text-decoration: line-through;
		color: #666;
		font-size: 20rpx;
	}

	.color-red {
		color: #ff0000;
		font-weight: 700;
		font-size: 35rpx;
	}

	.floor-card {
		width: 100%;
		border-radius: 5%;
		overflow: hidden;
		background-color: #fff;

		.image {
			width: 100%;
		}
	}

	.card-title {
		font-size: 28rpx;
	}
</style>
